package edu.gmu.messages;

import edu.gmu.middleware.Message;
import edu.gmu.streams.BlockInputStream;
import edu.gmu.streams.BlockOutputStream;
import java.io.IOException;

/* this class represents a calendar event */
public class ReplicateResponse implements Message
{ 
  public EndPoint calendarMgrEndpoint;
//  public List<User> users;

  public ReplicateResponse()
  {
      
  }
  
  public ReplicateResponse(EndPoint calendarMgrEndpoint)
  {
    this.calendarMgrEndpoint = calendarMgrEndpoint;
//    this.users = users;
  }


  public void marshal(BlockOutputStream stream) throws IOException
  {
      boolean isNull = (this.calendarMgrEndpoint == null);
      stream.writeBoolean(isNull);
      if( isNull == false )
      {
        this.calendarMgrEndpoint.marshal(stream);
      }
//    stream.writeInt( users.size() );
//    for ( int i = 0; i < users.size(); i++ )
//    {
//      ((User)this.users.get(i)).marshal( stream );
//    }
  }

  public void unmarshal(BlockInputStream stream) throws IOException
  {
      boolean isNull = stream.readBoolean();
      if( isNull == false )
      {
        this.calendarMgrEndpoint = new EndPoint();
        this.calendarMgrEndpoint.unmarshal(stream);
      }
//    int tempSize = stream.readInt();
//    this.users = new ArrayList<User>();
//    for( int i = 0; i < tempSize; i++){
//      User user = new User();
//      user.unmarshal(stream);
//      this.users.add(user);
//    }
  }
}
